package com.zcx.qshop;

import android.content.Context;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.zcx.helper.app.AppApplication;
import com.zcx.helper.http.Http;
import com.zcx.helper.init.Helper;
import com.zcx.helper.scale.ScaleScreenHelper;
import com.zcx.helper.scale.ScaleScreenHelperFactory;
import com.zcx.helper.util.UtilSDCard;
import com.zcx.qshop.action.LoginAction;
import com.zcx.qshop.action.ShareAction;
import com.zcx.qshop.action.ShoppingAction;
import com.zcx.qshop.db.QSDataBase;
import com.zcx.qshop.dialog.LoadDialog;

/**
 * Created by Administrator on 2015/8/7 0007.
 */
public class QSApplication extends AppApplication{

    public static QSPreferences QSPreferences;

    public static ScaleScreenHelper ScaleScreenHelper;

    public static LoginAction LoginAction;

    public static QSDataBase QSDataBase;

    public static ShoppingAction ShoppingAction;

    public static ShareAction ShareAction;

    @Override
    public void onCreate() {

        super.onCreate();

        Helper.Initialize(this, "QShop");

        Http.getInstance().setIsLog(true);

        Http.getInstance().setCache(UtilSDCard.getSDCardPath() + "yc", 1024 * 1024 * 10);

        Http.getInstance().setOnStartEndCreateDialog(new Http.OnStartEndCreateDialog<LoadDialog>() {

            @Override
            public LoadDialog onCreate(Context context) {

                return new LoadDialog(context);

            }

            @Override
            public void show(LoadDialog loadDialog) {

                loadDialog.show();

            }

            @Override
            public void dismiss(LoadDialog loadDialog) {

                loadDialog.exit();

            }

        });

        QSPreferences = new QSPreferences(this);

        ScaleScreenHelper = ScaleScreenHelperFactory.create(this, 720, 1.1f);

        ShoppingAction = new ShoppingAction();

        LoginAction = new LoginAction(this);

        QSDataBase = new QSDataBase(this);

        ShareAction = new ShareAction(this);

        Fresco.initialize(this);

    }

}
